//!wrt $BSPEC:{"icn":"apps/explorer","cpr":"Copyright (C) Windows 96 Team 2023.","dsc":"System File Explorer","frn":"Explorer","ver":1,"ssy":"gui"}
const{wait:wait,sizeFmt:sizeFmt}=w96.util,{IFileSystem:IFileSystem,RemoteReadOnlyFileSystem:RemoteReadOnlyFileSystem}=w96.fstype,{FSFeatures:FSFeatures,WindowParams:WindowParams,sysConf:SCM}=w96,{ContextMenu:ContextMenu,MsgBoxSimple:MsgBoxSimple,MenuBar:MenuBar,Theme:Theme,DialogCreator:DialogCreator}=w96.ui,{ToolBar:ToolBar,TabControl:TabControl,FSView:FSView,ExplorerAddressBar:ExplorerAddressBar,GroupBox:GroupBox,ListBox:ListBox}=w96.ui.components,{DirMetadataReader:DirMetadataReader,execFile:execFile,execCmd:execCmd,renderBSOD:renderBSOD}=w96.sys;class ExplorerToolbar extends ToolBar{constructor(e={}){let t,i;super(),e={backwards:!0,forwards:!0,up:!0,delete:!1,properties:!1,iconMap:{},...e},this.fsv=null,this.navigate=null,e.backwards&&(t=this.addItem({text:"Back",imageUrl:e.iconMap.back,isDropdown:!0,dropdownMenu:new ContextMenu,onclick:()=>{i.el.removeAttribute("disabled"),this.navigate(this.fsv.backwards(!1),!1,!1),0===this.fsv.historyPos&&t.el.setAttribute("disabled","true")}}),t.el.setAttribute("disabled","true"),this.btnBackwards=t),e.forwards&&(i=this.addItem({text:"Forward",imageUrl:e.iconMap.forward,isDropdown:!0,dropdownMenu:new ContextMenu,onclick:()=>{t.el.removeAttribute("disabled"),this.navigate(this.fsv.forwards(!1),!1,!1),this.fsv.historyPos+1===this.fsv.history.length&&i.el.setAttribute("disabled","true")}}),i.el.setAttribute("disabled","true"),this.btnForwards=i),e.up&&this.addItem({text:"Up",imageUrl:e.iconMap.up,onclick:()=>{this.navigate(this.fsv.up(!1))}}),this.getElement().insertAdjacentHTML("beforeend",'<div class="vseparator"></div>'),this.addItem({text:"Cut",imageUrl:e.iconMap.cut,onclick:()=>{this.fsv.performClipboard("cut")}}),this.addItem({text:"Copy",imageUrl:e.iconMap.copy,onclick:()=>{this.fsv.performClipboard("copy")}}),this.addItem({text:"Paste",imageUrl:e.iconMap.paste,onclick:()=>{this.fsv.performClipboard("paste")}}),this.getElement().insertAdjacentHTML("beforeend",'<div class="vseparator"></div>'),e.delete&&this.addItem({text:"Delete",imageUrl:e.iconMap.delete,onclick:()=>{let e=this.fsv.selectedIcons[0];e&&this.ondelete(e.getAttribute("path"),e.getAttribute("ent"))}}),e.properties&&this.addItem({text:"Properties",imageUrl:e.iconMap.properties,onclick:()=>{let e=this.fsv.selectedIcons[0];e&&this.onproperties(e.getAttribute("path"))}})}update(){this.fsv.historyPos+1!=this.fsv.history.length&&this.btnForwards&&this.btnForwards.el.setAttribute("disabled","true"),0!==this.fsv.history.length&&this.btnBackwards&&this.btnBackwards.el.removeAttribute("disabled")}}function addVolumeTab(e,t){e.addPage("Volume",(e=>{e.classList.add("tab-volume");const i=FSUtil.deconstructFullPath(t),a=FS.get(i.prefix);a&&appendFields(e,[{name:"Driver Name",value:a.driverName},{name:"Features",value:a.features.length>0?a.features.join(", "):"(no special features)"},{name:"Label",value:a.volumeLabel}])}))}function parseSubsystem(e){if(!e)return"(none)";switch(e){default:return e;case"gui":return"GUI";case"cli":return"Command-Line Interface"}}async function addProgramTab(e,t){let i;const a=FSUtil.deconstructFullPath(t),s=FS.get(a.prefix);if(!s.features.includes(w96.FSFeatures.remote)&&!s.remote&&(await FS.stat(t)).length<10485760){const a=await FS.readStrChunk(t,0,256);if(!a.startsWith("//!wrt"))return;if(a.includes("$BSPEC:")){const t=a.indexOf("\n"),s=a.substring(a.indexOf("$BSPEC:"),-1==t?void 0:t);try{i=JSON.parse(s.substring(7))}catch(e){return void console.error(e)}}}i&&e.addPage("Version",(e=>{var t,a;e.classList.add("tab-version"),appendFields(e,[{name:"File version",value:null!=i.ver?i.ver.toFixed(1):"<unknown>"},{name:"Description",value:null!==(t=i.dsc)&&void 0!==t?t:"(none)"},{name:"Copyright",value:null!==(a=i.cpr)&&void 0!==a?a:"(none)"}]);const s=new GroupBox({title:"Other version information",body:""}).getElement();let n;const o=document.createElement("div");o.classList.add("vinfo-table");const r=document.createElement("div");r.classList.add("left");const l=new ListBox;l.addItem("Author","author").addEventListener("click",(()=>{var e;return n.value=null!==(e=i.aut)&&void 0!==e?e:"(none)"})),l.addItem("Friendly Name","friendlyName").addEventListener("click",(()=>{var e;return n.value=null!==(e=i.frn)&&void 0!==e?e:"(none)"})),l.addItem("Subsystem","subsystem").addEventListener("click",(()=>n.value=parseSubsystem(i.ssy))),r.appendChild(l.getElement());const c=document.createElement("div");c.classList.add("right"),n=document.createElement("textarea"),n.readOnly=!0,n.disabled=!0,n.value="",c.appendChild(n),o.appendChild(r),o.appendChild(c),s.querySelector(".content").appendChild(o),e.appendChild(s)}))}function appendFields(e,t){t.forEach((t=>{let i=document.createElement("div");i.classList.add("field"),i.innerHTML=`<span class="name">${t.name}:</span><span class="value">${t.value}</span>`,e.appendChild(i)}))}async function showPropertiesDialog(e,t){if(!await FS.exists(t))return void MsgBoxSimple.error("Error","Unable to display properties.","OK");const i=await FS.stat(t),a=FSUtil.fname(t),s=""==a.trim(),n=1==await FS.filetype(t),o=[{name:"Name",value:s?t.substring(0,2):a},{name:"Type",value:s?"Volume":n?"Directory":"Regular File"},{name:"Path",value:t},{name:"Size",value:sizeFmt.getSizeStringFromLength(i.length)+(i.length>1024?` (${i.length} bytes)`:"")},{name:"FS Record",value:null!=i.recordId&&"_null_"!=i.recordId?i.recordId:"Not present"}],r=e.createWindow({draggable:!0,initialHeight:463,initialWidth:389,resizable:!1,controlBoxStyle:"WS_CBX_CLOSE",title:"Properties for "+(s?t.substring(0,2):a),bodyClass:"wexplorer-app-propdlg",body:'<div class="tabc"></div>\n <div class="buttons">\n <button class="w96-button apply" disabled>Apply</button>\n <button class="w96-button cancel">Cancel</button>\n <button class="w96-button ok">OK</button>\n </div>'},!1),l=new TabControl;l.openPage(l.addPage("General",(async e=>{e.innerHTML=`\n <div class="p1">\n <div class="icon" style="background-image: url(${await Theme.getFileIconUrl(t)})"></div>\n <input type="text" class="w96-textbox namebox" value="${s?t.substring(0,2):a}" disabled>\n </div>\n <div class="w96-ui-inset-separator"></div>\n <div class="p2"></div>\n `,e.classList.add("tab-general"),appendFields(e,o)}))),s&&addVolumeTab(l,t),n||await addProgramTab(l,t);const c=r.getBodyContainer();c.classList.add("propwnd-base"),c.querySelector(".tabc").replaceWith(l.getElement()),c.querySelector("button.cancel").addEventListener("click",(()=>r.close())),c.querySelector("button.ok").addEventListener("click",(()=>r.close())),r.show()}var uiLayouts={main:""};const READ_ONLY_CMDS_INVAL=["cut","copy","paste","delete","rename","mklink","mkdir","mkfile"],SYSTEM_DRIVES=["C:/","W:/"];class ExplorerApplication extends WApplication{constructor(){super()}async main(e){if(super.main(e),e.shift(),"--prop"==e[0]&&await FS.exists(e[1]))return showPropertiesDialog(this,e[1]),void this.terminate();var t=null!=e[0]?e[0]:"computer://";"computer://"!==t&&(t=t[0].toUpperCase()+t.substring(1)),await FS.exists(t)||(t="computer://");const i=new WindowParams;i.resizable=!1,i.title="computer://"==t?"Computer":3==t.length?t:FSUtil.fname(t),i.initialWidth=570,i.initialHeight=480,i.resizable=!0;const a=this.createWindow(i,!0);a.useIcon=!0,a.registerWindow(),a.registerAppBar(),a.setWindowIcon(await Theme.getIconUrl("apps/explorer","16x16")),a.setControlBoxStyle("WS_CBX_MINMAXCLOSE"),a.setHtml(uiLayouts.main),this.mainwnd=a,this.options={showSidebar:1,showHiddenFiles:1,metaLookup:1,specialPaths:[],compactToolbar:1};const s=new MenuBar;s.addRoot("File",[{type:"normal",label:"Create Directory",onclick:()=>{this._ui_newDir()}},{type:"normal",label:"Create File",onclick:()=>{this._ui_newFile()}},{type:"separator"},{type:"normal",label:"Exit",onclick:()=>{this.terminate()}}]),s.addRoot("View",[{type:"normal",label:"Refresh",onclick:()=>{this.refresh()}}]),s.addRoot("Go",[{type:"normal",icon:await Theme.getIconUrl("devices/computer","16x16"),label:"Computer",onclick:()=>{this.navigate("computer://")}},{type:"separator"},{type:"normal",icon:await Theme.getIconUrl("devices/hdd","16x16"),label:"ROFS SYSROM",onclick:()=>{this.navigate("X:/")}},{type:"normal",icon:await Theme.getIconUrl("devices/hdd","16x16"),label:"ROFS BOOT drive",onclick:()=>{this.navigate("B:/")}},{type:"normal",icon:await Theme.getIconUrl("devices/hdd","16x16"),label:"ROFS W:/",onclick:()=>{this.navigate("W:/")}},{type:"separator"},{type:"normal",icon:await Theme.getIconUrl("devices/hdd","16x16"),label:"Z:/",onclick:()=>{this.navigate("Z:/")}},{type:"normal",icon:await Theme.getIconUrl("devices/hdd","16x16"),label:"System Drive",onclick:()=>{this.navigate("c:/")}}]);const n=[{type:"normal",label:"Read-only FS",onclick:()=>{MsgBoxSimple.prompt("Mount Read-only File System","Enter the ROFS URL below.","",(async e=>{if(e&&""!=e.trim())try{const t=new RemoteReadOnlyFileSystem(FS.nextLetter(),e);await FS.mount(t)}catch(e){MsgBoxSimple.error("Mount Failure","Failed to mount specified image.","OK")}}))}}],o=[{type:"normal",label:"Upload",onclick:()=>{if("computer://"==this.currentPath)return;const e=new WindowParams;e.initialHeight=150,e.initialWidth=300,e.title="Upload File",e.resizable=!1;const t=this.createWindow(e,!1);t.registerWindow(),t.setControlBoxStyle("WS_CBX_CLOSE");const i=t.getBodyContainer();i.classList.add("uploader-app"),i.innerHTML='Choose files below and press "Start" to upload them.<br><br>The uploaded files will be saved to this folder.\n <br><br>\n <input type="file" class="w96-textbox" multiple=""><br>\n <button class="w96-button start">Start</button>';const a=i.querySelector(".start"),s=i.querySelector("input");a.onclick=async()=>{a.disabled=!0;const e=MsgBoxSimple.idleProgress("Upload in progress","The selected files are being saved, please wait...");e.show();for(let e=0;e<s.files.length;e++){const t=s.files.item(e),i=(3==this.currentPath.length?this.currentPath:this.currentPath+"/")+t.name;console.log("Writing "+i);const a=new Uint8Array(await t.arrayBuffer());await FS.writebin(i,a)}setTimeout((()=>{a.disabled=!1,e.closeDialog(),this.navigate(this.currentPath,!0)}),250)},t.show(),t.center()}},{type:"separator"},{type:"submenu",label:"Mount",removeIconPrespace:!0,items:n}];n.push({type:"normal",label:"P3 FS",onclick:()=>{execCmd("p3fs",["--connect"])}}),s.addRoot("Tools",o),s.addRoot("Help",[{type:"normal",label:"About File Hacker",onclick:()=>{alert('<span class="bold-noaa">File Hacker</span><br>Version 1.2<br>',{title:"About File Hacker",icon:"info"})}}]),this.appBar=s;const r=document.createElement("div");r.classList.add("w96-footer"),this.infoFooter=document.createElement("div"),this.infoFooter.innerText="0 items",this.infoFooter.classList.add("cell"),r.appendChild(this.infoFooter),this.fsv=new FSView("c:/",!0),this.fsv.init(),this.fsv.uiComponent.style.width=i.initialWidth+"px",this.fsv.uiComponent.style.height=i.initialHeight+"px",this.fsv.setSize("100%","100%");const l=new ExplorerAddressBar({compactToolbar:this.options.compactToolbar});let c;var d,p;l.navigate=(...e)=>this.navigate(...e),l.fsv=this.fsv,this.pathBar=l.input,this.pathBar.value=t,this.options.compactToolbar||(c=new ExplorerToolbar({delete:!0,properties:!0,iconMap:{up:await Theme.getIconUrl("actions/up","24x24"),back:await Theme.getIconUrl("actions/back","24x24"),forward:await Theme.getIconUrl("actions/forward","24x24"),cut:await Theme.getIconUrl("actions/cut","24x24"),copy:await Theme.getIconUrl("actions/copy","24x24"),paste:await Theme.getIconUrl("actions/paste","24x24"),delete:await Theme.getIconUrl("actions/delete","24x24"),properties:await Theme.getIconUrl("actions/properties","24x24")}}),c.fsv=this.fsv,c.navigate=(...e)=>this.navigate(...e),c.ondelete=(...e)=>this._ui_delete(...e),c.onproperties=(...e)=>showPropertiesDialog(this,...e),this.toolBar=c),d=this.fsv,p=this,a.ondarkenelements=function(){d.uiComponent.querySelectorAll(".shell-icon.selected").forEach((e=>{e.classList.add("inactive")}))},a.onlightenelements=function(){d.uiComponent.querySelectorAll(".shell-icon.inactive").forEach((e=>{e.classList.remove("inactive")})),d.uiComponent.focus()},d.uiComponent.oncontextmenu=function(e){for(var t=e.target;!t.classList.contains("exp-file-view");){if(t.classList.contains("shell-icon"))return;t=t.parentNode}e.preventDefault(),d.deselectAllIcons();let i=[{type:"normal",label:"Create Directory",class:"mkdir",onclick:function(){p._ui_newDir()}},{type:"normal",label:"Create File",class:"mkfile",onclick:function(){p._ui_newFile()}},{type:"separator"},{type:"normal",label:"Paste",class:"paste",disabled:!0,onclick:function(){d.performClipboard("paste")}},{type:"separator"},{type:"normal",label:"Refresh",class:"refresh",onclick:function(){"computer://"!=d.fsPath&&p.navigate(p.currentPath,!0,!1)}}];document.querySelectorAll(".wcontext-menu").forEach((e=>e.remove()));const a=FSUtil.deconstructFullPath(d.fsPath);if("computer://"==d.fsPath)i=[{type:"normal",label:"Refresh",class:"refresh",onclick:function(){p.refresh()}}];else if(w96.wmem.clipboard&&w96.wmem.clipboard.items.length>0&&(i.find((e=>"paste"==e.class)).disabled=!1),FS.get(a.prefix).features.includes(FSFeatures.readOnly))for(let e of i)READ_ONLY_CMDS_INVAL.includes(e.class)&&(e.disabled=!0);new ContextMenu(i).renderMenu(e.x,e.y)};const h=a.wndObject.querySelector(".window-html-content");h.classList.add("wexplorer-app");let u=document.createElement("div");if(u.classList.add("w96-ui-inset"),u.appendChild(s.getMenuDiv()),this.options.compactToolbar||u.appendChild(this.toolBar.getElement()),u.appendChild(l.getElement()),h.appendChild(u),this.fsv.options.showHiddenFiles=this.options.showHiddenFiles,this.fsv.options.metaLookup=this.options.metaLookup,this.options.showSidebar){const e=document.createElement("div");e.classList.add("view-box");const t=document.createElement("div");t.classList.add("file-box");const i=document.createElement("div");i.classList.add("sidebar");const a=document.createElement("div");a.classList.add("icon");const s=document.createElement("div");s.classList.add("name");const n=document.createElement("div");n.classList.add("line");const o=document.createElement("div");o.classList.add("desc"),t.appendChild(a),t.appendChild(s),t.appendChild(n),t.appendChild(o),i.appendChild(t),e.appendChild(i),e.appendChild(this.fsv.getElement()),h.appendChild(e)}else h.appendChild(this.fsv.getElement());h.appendChild(r),this.fsv.onitemdblclick=async e=>{const t=parseInt(e.getAttribute("ent"),10);switch(t){case 0:execFile.call({_cachedFiletype:t},e.getAttribute("path")).catch((e=>{MsgBoxSimple.error("Error",e,"OK"),console.error(e)}));break;case 1:case 2:this.fsv.deselectAllIcons(),this.navigate(e.getAttribute("path"))}},this.fsv.ondropfinish=()=>{this.navigate(this.currentPath,!0),this.mainwnd.activate()},this.fsv.onrefreshneeded=()=>this.refresh(),a.onshown=()=>{this.navigate(t,!1)},a.onclose=()=>{},this._ui_wc=h,a.show(),this.fsv.uiComponent.addEventListener("keydown",(e=>{if(this.mainwnd.isActive()&&"Delete"==e.key){e.preventDefault(),e.stopPropagation();const t=this.fsv.uiComponent.querySelector(".shell-icon.selected");if(!t)return;const i=t.getAttribute("path"),a=t.getAttribute("ent");if("2"==a)return;this._ui_delete(i,a)}})),this._ui_delete_busy=!1;let m=!0;this.fsv.onclipboard=async()=>{this.mainwnd.wndObject&&m&&(m=!1,this.refresh&&await this.refresh(),await wait(10),this.mainwnd.activate(),m=!0)}}_reloadCb(){this.refresh()}_navComplete(e){this.infoFooter.innerText=1==e.length?"1 item":`${e.length} items`,this.fsv.uiComponent.querySelectorAll(".shell-icon").forEach((e=>{this.options.specialPaths.includes(this.currentPath.toLowerCase())&&e.classList.add("special"),e.oncontextmenu=t=>{document.querySelectorAll(".wcontext-menu").forEach((e=>e.remove())),this.mainwnd.activate();const i=e.getAttribute("ent"),a=e.getAttribute("path");let s;if("computer://"==this.currentPath){s=[{type:"normal",label:"Unmount",class:"unmount",onclick:async()=>{const e=this.mainwnd.getBodyContainer();e.classList.add("busy");try{await FS.umount(a.substring(0,2))}catch(e){console.error(e)}e.classList.remove("busy"),this.refresh()}},{type:"normal",label:"Make Link",class:"mklink",onclick:async()=>{const e={action:a};await FS.writestr(`C:/user/desktop/Link to (${a[0]}).link`,JSON.stringify(e)),DialogCreator.alert("A shortcut icon has been placed on your desktop.",{icon:"info"})}},{type:"separator"},{type:"normal",label:"Properties",onclick:()=>showPropertiesDialog(this,a)}];for(let e of s)SYSTEM_DRIVES.includes(a.toUpperCase())&&"unmount"==e.class&&(e.disabled=!0)}else s=[{type:"normal",label:"Open",onclick:()=>{e.ondblclick(t)}},{type:"normal",label:"Open with...",class:"openwith",onclick:()=>{execCmd("openwith",[a])}},{type:"normal",label:"Download",class:"download",onclick:()=>{"1"!=i?FSUtil.downloadFile(a):MsgBoxSimple.error("Error","Not implemented","OK")}},{type:"separator"},{type:"normal",label:"Cut",class:"cut",onclick:async()=>{this.fsv.performClipboard("cut")}},{type:"normal",label:"Copy",onclick:async()=>{this.fsv.performClipboard("copy")}},{type:"separator"},{type:"normal",label:"Make Link",class:"mklink",onclick:async()=>{const e={action:a},t=FSUtil.fname(a);let i=(3==this.currentPath.length?this.currentPath:this.currentPath+"/")+`Link to ${t}.link`;t.endsWith(".link")?(i=(3==this.currentPath.length?this.currentPath:this.currentPath+"/")+`Copy of ${t}`,await FS.cpfile(a,i)):await FS.writestr(i,JSON.stringify(e)),this.refresh()}},{type:"normal",label:"Rename",class:"rename",onclick:async()=>{MsgBoxSimple.prompt("Rename","Enter the new name of the entry.",FSUtil.fname(a),(async e=>{null!=e&&(await FS.rename(a,e),this.navigate(this.currentPath,!0))}))}},{type:"normal",label:"Delete",class:"delete",onclick:async()=>{this._ui_delete(a,i)}},{type:"separator"},{type:"normal",label:"Properties",onclick:()=>{showPropertiesDialog(this,a)}}];const n=new ContextMenu(s);"1"==i&&(n.items=n.items.filter((e=>"openwith"!=e.class&&"download"!=e.class)));const o=FSUtil.deconstructFullPath(this.fsv.fsPath);if(FS.get(o.prefix).features.includes(FSFeatures.readOnly))for(let e of n.items)READ_ONLY_CMDS_INVAL.includes(e.class)&&(e.disabled=!0);n.renderMenu(t.x,t.y)}}))}async _ui_delete(e,t){if(!this._ui_delete_busy){if(this._ui_delete_busy=!0,"1"==t&&"c:/system"==e.toLowerCase())return await FS.rmdir(e),void("c:/system"!=e&&"C:/system"!=e||(await wait(2e3),renderBSOD("Cannot find system folder c:/system!")));try{await execCmd("recyclui",[e])}catch(e){console.error(e)}this.fsv.uiComponent.focus(),this._ui_delete_busy=!1,this.navigate(this.currentPath,!0),await wait(10),this.mainwnd.activate()}}_ui_newDir(){this.fsv.uiCreateDirectory((e=>{e&&this.refresh()}))}async _ui_sidebar_update(e,t,i){if(this.options.showSidebar){const a=this._ui_wc.querySelector(".sidebar>.file-box");a.querySelector(".name").innerText=t,a.querySelector(".icon").style.backgroundImage=`url(${e})`,a.querySelector(".desc").innerText="",i&&(await i.read(),i.properties.description&&(a.querySelector(".desc").innerText=i.properties.description))}}_ui_newFile(){this.fsv.uiCreateFile((e=>{e&&this.refresh()}))}async navigate(e,t,i=!0){if(this.fsv.uiComponent.focus(),"computer://"!=e&&!await FS.exists(e))return MsgBoxSimple.error("Error","Directory does not exist.","OK",(()=>{setTimeout((()=>this.mainwnd.activate()),10)}));i&&e!==this.currentPath&&!this.options.compactToolbar&&this.toolBar.update(),this.currentPath=e,this.pathBar.value=this.currentPath;let a=null;switch(this.options.metaLookup&&(a=new DirMetadataReader(e)),this.currentPath){case"computer://":this.mainwnd.setTitle("Computer"),this.mainwnd.setWindowIcon(await Theme.getIconUrl("devices/computer","16x16")),this._ui_sidebar_update(await Theme.getIconUrl("devices/computer"),"My Computer",a);break;case"C:/trash":this.mainwnd.setTitle("Recycle Bin"),this.mainwnd.setWindowIcon(await Theme.getIconUrl("places/trash","16x16")),this._ui_sidebar_update(await Theme.getIconUrl("places/trash"),"Recycle Bin",a);break;default:if(3==this.currentPath.length){const e=this.currentPath.substring(0,2),t=FS.get(e);let i="devices/hdd";switch(t.driverName){default:case"idbfs":break;case"localfs":i="devices/floppy";break;case"ramfs":i="devices/memory";break;case"zipfs-ro":i="places/folder";break;case"rofs":i="devices/hdd-ro";break;case"p3fs":i="apps/p3fs"}this.mainwnd.setTitle(this.currentPath),this._ui_sidebar_update(await Theme.getIconUrl(i),t.volumeLabel+" ("+e+")",a),this.mainwnd.setWindowIcon(await Theme.getIconUrl(`${i}`,"16x16"))}else this.mainwnd.setTitle(FSUtil.fname(this.currentPath)),this._ui_sidebar_update(await Theme.getFileIconUrl(this.currentPath),FSUtil.fname(this.currentPath),a),this.mainwnd.setWindowIcon(await Theme.getIconUrl("places/folder-open","16x16"))}this.fsv.navigate(e,(e=>this._navComplete(e)),t,i)}setViewMode(e){return this.fsv.setViewMode(e)}async refresh(){await this.navigate(this.currentPath,!0,!1)}ontermination(){super.ontermination()}}
return await WApplication.execAsync(new ExplorerApplication(), this.boxedEnv.args, this);